import { Component } from '@angular/core';
import { Hobby } from './hobby';
@Component({
  selector: 'my-app',
  template: `
	<h2>My First Angular 2 App</h2>
    <h3>爱好：</h3>
	<ul>
        <li *ngFor="let hobby of hobbys">{{hobby.name}}</li>    
    </ul>
    <p *ngIf="hobbys.length >= 3">爱好很多嘛！</p>
  `
})

/*
 *  *ngFor循环指令，注意*不要漏掉
 *  import { Hobby } from './hobby'; 导入对象，form后面跟路径
 */
/
export class AppComponent {
    //在/app目录添加hobby.ts文件创建Hobby对象
  hobbys = [
      new Hobby(1,'篮球'),
      new Hobby(2,'足球'),
      new Hobby(3,'羽毛球')
  ];
}